package web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONException;

import web.factory.CreateTranceFactory;
import factotyService.ServiceProcess;

public class FactoryServlet extends HttpServlet {
	/**
     * 
     */
    private static final long serialVersionUID = 1L;
    /**
	 * 处理类
	 */
	private ServiceProcess serviceProcess = null;
	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, 
	 *     javax.servlet.http.HttpServletResponse)
	 * *.action请求的 处理入口
	 */
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {
		try {
			//工厂创建具体实例对象
			serviceProcess = CreateTranceFactory.getTrance(req, res);
			serviceProcess._do();
		} catch (JSONException e) {
			System.out.println("工厂获取service失败");
			e.printStackTrace();
		}
	}

}
